<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/test', function () {

    $code = '133856286605905956';
    $leshua = new \App\LeShua\LeShua("9455611205");
    $response = $leshua->scanPay($code, 'TEST-'.time(), 1);
});

Route::get('/test/order/payed', function (\Illuminate\Http\Request $request) {

    $onlineTradeOrder = \App\Models\OnlineTradeOrder::where('order_no', $request->order_no)->first();
    $onlineTradeOrder->payed();
});

Route::prefix('/notify')->group(function () {
    Route::any('/leshua', [\App\Http\Controllers\Counter\OrderNotifyController::class, 'leshuaPay']);
});

//Route::get("/create_test_admin", function () {
//    \App\Models\User::create([
//        'name' => '测试员',
//        'nickname' => '测试员',
//        'password' => \Illuminate\Support\Facades\Hash::make('testadmin'),
//        'telephone' => 'testadmin',
//        'type' => \App\Enums\UserType::System->value,
//        'store_id' => 0,
//        'status' => \App\Enums\UserStatus::Normal,
//        'remark' => '测试员无法删除',
//        'code' => 'admin',
//        'role_id' => 0,
//        'parent_user_id' => 0,
//    ]);
//});
